#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
	int l, r;
	cin >> l >> r;
	int ans = 0;
	for (int i = l; i <= r; i++) {
		int x = i;
		while (x) {
			ans += x % 10 == 2;
			x /= 10;
		}
	}
	cout << ans;
	return 0;
}
